package com.ruoyi.web.controller.dr;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.dr.domain.DrHomeTag;
import com.ruoyi.dr.service.IDrHomeTagService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 达人标签页 - 关联 daren_homeController
 * 
 * @author ruoyi
 * @date 2025-07-12
 */
@RestController
@RequestMapping("/dr/tag")
public class DrHomeTagController extends BaseController
{
    @Autowired
    private IDrHomeTagService drHomeTagService;

    /**
     * 查询达人标签页 - 关联 daren_home列表
     */
    @PreAuthorize("@ss.hasPermi('dr:tag:list')")
    @GetMapping("/list")
    public TableDataInfo list(DrHomeTag drHomeTag)
    {
        startPage();
        List<DrHomeTag> list = drHomeTagService.selectDrHomeTagList(drHomeTag);
        return getDataTable(list);
    }

    /**
     * 导出达人标签页 - 关联 daren_home列表
     */
    @PreAuthorize("@ss.hasPermi('dr:tag:export')")
    @Log(title = "达人标签页 - 关联 daren_home", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DrHomeTag drHomeTag)
    {
        List<DrHomeTag> list = drHomeTagService.selectDrHomeTagList(drHomeTag);
        ExcelUtil<DrHomeTag> util = new ExcelUtil<DrHomeTag>(DrHomeTag.class);
        util.exportExcel(response, list, "达人标签页 - 关联 daren_home数据");
    }

    /**
     * 获取达人标签页 - 关联 daren_home详细信息
     */
    @PreAuthorize("@ss.hasPermi('dr:tag:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(drHomeTagService.selectDrHomeTagById(id));
    }

    /**
     * 新增达人标签页 - 关联 daren_home
     */
    @PreAuthorize("@ss.hasPermi('dr:tag:add')")
    @Log(title = "达人标签页 - 关联 daren_home", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DrHomeTag drHomeTag)
    {
        return toAjax(drHomeTagService.insertDrHomeTag(drHomeTag));
    }

    /**
     * 修改达人标签页 - 关联 daren_home
     */
    @PreAuthorize("@ss.hasPermi('dr:tag:edit')")
    @Log(title = "达人标签页 - 关联 daren_home", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DrHomeTag drHomeTag)
    {
        return toAjax(drHomeTagService.updateDrHomeTag(drHomeTag));
    }

    /**
     * 删除达人标签页 - 关联 daren_home
     */
    @PreAuthorize("@ss.hasPermi('dr:tag:remove')")
    @Log(title = "达人标签页 - 关联 daren_home", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(drHomeTagService.deleteDrHomeTagByIds(ids));
    }
}
